package com.huichaoliu.netUtils;

import org.json.JSONException;
import org.json.JSONObject;

import com.source.utils.Utils;
import com.ta.util.http.RequestParams;

public class ParamsUtils {
	/**
	 * 获取用户求救贴
	 * 
	 * @param userId
	 *            用户ID
	 * @param state
	 *            类型 : 0 未完成,1已处理,2已完成,4失败
	 * @param pageno
	 * @param pagesize
	 * 
	 * @return
	 */
	public static RequestParams dpusernotelist(String userId, int state, int pageno, int pagesize) {
		RequestParams params = new RequestParams();
		JSONObject jo = new JSONObject();
		try {
			jo.put("userId", userId);
			jo.put("state", state);
			jo.put("pageno", pageno);
			jo.put("pagesize", pagesize);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			params.put("request", Utils.requestParamsEncode(jo));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return params;
	}

	/**
	 * 点赞取消点赞
	 * 
	 * @param userId
	 *            用户id
	 * @param noteId
	 *            求救贴id
	 * @param isadd
	 *            点赞和取消点赞
	 * 
	 * @return
	 */
	public static RequestParams notepraise(String userId, String noteId, boolean isadd) {
		RequestParams params = new RequestParams();
		JSONObject jo = new JSONObject();
		try {
			jo.put("userId", userId);
			jo.put("noteId", noteId);
			jo.put("isadd", isadd);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			params.put("request", Utils.requestParamsEncode(jo));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return params;
	}

	/**
	 * 求救贴评论
	 * 
	 * @param userId
	 *            用户id
	 * @param noteId
	 *            晒照id
	 * @param comment
	 *            评论
	 * @return
	 */
	public static RequestParams noteaddcomment(String userId, String noteId, String comment) {
		RequestParams params = new RequestParams();
		JSONObject jo = new JSONObject();
		try {
			jo.put("userId", userId);
			jo.put("noteId", noteId);
			jo.put("comment", comment);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			params.put("request", Utils.requestParamsEncode(jo));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return params;
	}

	/**
	 * 获取求救帖评论列表
	 * 
	 * @param userId
	 *            用户id
	 * @param noteId
	 *            晒照id
	 * 
	 * @return
	 */
	public static RequestParams notecommentlist(String userId, String noteId, int pageno, int pagesize) {
		RequestParams params = new RequestParams();
		JSONObject jo = new JSONObject();
		try {
			jo.put("userId", userId);
			jo.put("noteId", noteId);
			jo.put("pageno", pageno);
			jo.put("pagesize", pagesize);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			params.put("request", Utils.requestParamsEncode(jo));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return params;
	}

	/**
	 * 求救贴评回复
	 * 
	 * @param userId
	 *            用户id
	 * @param noteId
	 *            评论id
	 * @param comment
	 *            评论
	 * @return
	 */
	public static RequestParams notecommentreply(String userId, String noteId, String reply) {
		RequestParams params = new RequestParams();
		JSONObject jo = new JSONObject();
		try {
			jo.put("userId", userId);
			jo.put("noteId", noteId);
			jo.put("reply", reply);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		try {
			params.put("request", Utils.requestParamsEncode(jo));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return params;
	}
}
